#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cmath>
using namespace std;
int main()
{
	string str;
	string ans1, ans2;
	ans1.reserve(1000010);
	ans2.reserve(1000010);
	cin >> str;
	for (int i = 0; i < str.size(); i++) {
		if (str[i] == 'X') {
			ans1.push_back('1');
			ans2.push_back('0');
		}
		else if (str[i] == 'Y') {
			ans1.push_back('0');
			ans2.push_back('1');
		}
		else if(str[i] == 'Z') {
			int flag = 0;
			ans1.push_back('0');
			ans2.push_back('0');
			while (++i < str.size()) {
				if (str[i] != 'Z') {
					flag = 1;
					break;
				}
				ans1.push_back('0');
				ans2.push_back('0');
			}
			if (flag) {
				cout << -1;
				return 0;
			}
		}
	}
	cout << ans1 << endl;
	cout << ans2;
	return 0;
}